load("@rules_rust//rust:defs.bzl", "rust_test")

# generate a file containing cfg flags
genrule(
    name = "flag_generator",
    outs = ["generated_flag.data"],
    cmd = "echo --cfg=test_flag > $@",
)

rust_test(
    name = "test",
    srcs = [
        "main.rs",
    ],
    data = [":flag_generator"],
    edition = "2018",
    rustc_flags = [
        "@$(location :flag_generator)",
    ],
)
